// pages/my/my.js
const app = getApp();
const util = require('../../utils/util');
Page({
    /**
     * 页面的初始数据
     */
    data: {
        realName: '',
        phone: '',
        idcardNo: '',
        bankCardNo: '',
        bankName: ''
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        var userInfo = wx.getStorageSync('info');
        if (userInfo.bankName) {
            this.setData({
                bankName: userInfo.bankName
            })
        }
        if (userInfo.realName) {
            this.setData({
                realName: util.desensitization(userInfo.realName, 1, 0)
            })
        }
        if (userInfo.phone) {
            this.setData({
              phone: util.desensitization(userInfo.phone, 3, -4)
            })
        }
        if (userInfo.idcardNo) {
            this.setData({
              idcardNo: util.desensitization(userInfo.idcardNo, 3, -4)
            })
        }
        if (userInfo.bankCardNo) {
            this.setData({
              bankCardNo: util.desensitization(userInfo.bankCardNo, 3, -4)
            })
        }
    },

    submit: function () {
        wx.navigateTo({
            url: '/pages/income/income'
        })
    },
    getAgreement: function () {
        wx.navigateTo({
            url: '/pages/agreementList/agreementList'
        })
    },
    feedback: function () {
        wx.navigateTo({
            url: '/pages/feedback/feedback'
        })
    },
    telephone: function () {
        wx.makePhoneCall({
            phoneNumber: '4008650500',
            success:function(){
                console.log("拨打电话成功！")
            },
            fail:function(){
                console.log("拨打电话失败！")
            }
        })
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    }
})